package com.xmut.mall.cart.controller;

import com.xmut.mall.cart.service.CartService;
import com.xmut.mall.cart.utils.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("cart/cart")
public class CartController {

    @Autowired
    private CartService cartService;

    /**
     * 根据用户Id获取购物车列表
     * @param userId
     * @return
     */
    @GetMapping("/getCartList/{userId}")
    public RespBean getCartList(@PathVariable Long userId){
        return cartService.getCartList(userId);
    }
}
